﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bamboo.Utils
{
    /// <summary>
    /// 通用日志接口
    /// </summary>
    public interface ICommonLog
    {
        /// <summary>
        /// 记录调试日志
        /// </summary>
        /// <param name="s"></param>
        void Log(string s);
        /// <summary>
        /// 记录详细日志
        /// </summary>
        /// <param name="s"></param>
        void LogDetail(string s);
        /// <summary>
        /// 记录错误日志
        /// </summary>
        /// <param name="s"></param>
        void LogError(string s);
    }

    public static class LogHelper
    { 
        public static string GetLogText(DateTime time, string content, bool isError)
        {
            string stime = time.ToString("[yyyyMMdd,HHmmss]");
            if (isError)
            {
                return stime + "[ERROR] " + content;
            }
            else
            {
                return stime + " " + content;
            }
        }
    }

}
